<!--职务结算政策列表-->
<template>
  <div>
    <f-table ref='table' rowKey='policyPositionId' :columns='columns' :multiple='multiple' :autoLoad='false' :operator='operator' :params='queryParam' :api='api.bpp'>
        <span slot='action' slot-scope='text, record'>
          <template>
            <a @click='$refs.form.openModal(record)'>编辑</a>
            <a-divider type='vertical' />
          </template>
          <a-dropdown>
            <a class='ant-dropdown-link'>更多 <a-icon type='down' /></a>
            <a-menu slot='overlay'>
              <a-menu-item>
                <a href='javascript:;' @click='$refs.table.del(record)'>删除</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
    </f-table>
    <policy-position-form ref='form' @success="onSuccess" :policyDrugId='queryParam.policyDrugId'></policy-position-form>
  </div>
</template>
<script>
import api from "../../../../js/api"
import PolicyPositionForm from "./policy_position_form"

export default {
  name: "PolicyListPosition",
  components: { PolicyPositionForm },
  data() {
    let me = this
    //操作按钮
    let operator = []
    operator.push({
      name: "添加政策",
      icon: "plus",
      that: this,
      handler: (table) => {
        this.$refs.form.openModal()
      }
    })
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      //列表初始化查询参数
      queryParam: {
        auth: 1,
        policyDrugId: ""
      },
      columns: [
        {
          title: "序号",
          width: "60px",
          align: "left",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "职务名称",
          align: "center",
          width: "100px",
          dataIndex: "positionName"
        },
        {
          title: "结算价",
          align: "center",
          width: "60px",
          dataIndex: "positionPrice"
        },
        {
          title: "加价",
          align: "center",
          width: "60px",
          dataIndex: "makeUpPrice"
        },
        {
          title: "结算标准",
          align: "center",
          width: "60px",
          dataIndex: "positionRate"
        },
        {
          title: "结算公式",
          align: "center",
          ellipsis: true,
          width: "200px",
          dataIndex: "positionSettleFormula"
        },
        {
          title: "执行日期",
          align: "center",
          width:'100px',
          dataIndex: "beginDate"
        },
        {
          title: "结束日期",
          align: "center",
          width:'100px',
          dataIndex: "endDate"
        }, {
          title: "操作",
          align: "center",
          width: "110px",
          dataIndex: "action",
          scopedSlots: { customRender: "action" }
        }
      ],
      operator: operator
    }
  },
  created() {
  },
  methods: {
    setData(data) {
      //设置列表初始查询条件
      this.queryParam.policyDrugId = data.policyDrugId
      this.$refs.table.refresh(false)
    },
    onSuccess() {
      this.$refs.table.refresh()
    },
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    }
  }
}
</script>